package com.hiwhitley.potatoandtomato.dao;

import android.database.sqlite.SQLiteDatabase;

import java.util.Map;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.identityscope.IdentityScopeType;
import de.greenrobot.dao.internal.DaoConfig;

import com.hiwhitley.potatoandtomato.bean.Tomato;
import com.hiwhitley.potatoandtomato.bean.DailyEvent;
import com.hiwhitley.potatoandtomato.bean.Suggest;

import com.hiwhitley.potatoandtomato.dao.TomatoDao;
import com.hiwhitley.potatoandtomato.dao.DailyEventDao;
import com.hiwhitley.potatoandtomato.dao.SuggestDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see de.greenrobot.dao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig tomatoDaoConfig;
    private final DaoConfig dailyEventDaoConfig;
    private final DaoConfig suggestDaoConfig;

    private final TomatoDao tomatoDao;
    private final DailyEventDao dailyEventDao;
    private final SuggestDao suggestDao;

    public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        tomatoDaoConfig = daoConfigMap.get(TomatoDao.class).clone();
        tomatoDaoConfig.initIdentityScope(type);

        dailyEventDaoConfig = daoConfigMap.get(DailyEventDao.class).clone();
        dailyEventDaoConfig.initIdentityScope(type);

        suggestDaoConfig = daoConfigMap.get(SuggestDao.class).clone();
        suggestDaoConfig.initIdentityScope(type);

        tomatoDao = new TomatoDao(tomatoDaoConfig, this);
        dailyEventDao = new DailyEventDao(dailyEventDaoConfig, this);
        suggestDao = new SuggestDao(suggestDaoConfig, this);

        registerDao(Tomato.class, tomatoDao);
        registerDao(DailyEvent.class, dailyEventDao);
        registerDao(Suggest.class, suggestDao);
    }
    
    public void clear() {
        tomatoDaoConfig.getIdentityScope().clear();
        dailyEventDaoConfig.getIdentityScope().clear();
        suggestDaoConfig.getIdentityScope().clear();
    }

    public TomatoDao getTomatoDao() {
        return tomatoDao;
    }

    public DailyEventDao getDailyEventDao() {
        return dailyEventDao;
    }

    public SuggestDao getSuggestDao() {
        return suggestDao;
    }

}
